package com.hxk.ioc.bean;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

/**
 * 通过实现InitializingBean和DisposableBean接口来实现初始化和销毁方法
 */
public class Car implements InitializingBean, DisposableBean {

    public Car(){
        System.out.println("init car-----");
    }

    /**
     * 设置属性之前
     */
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("car--------InitializingBean-------afterPropertiesSet-----");
    }

    /**
     * 销毁
     * @throws Exception
     */
    @Override
    public void destroy() throws Exception {
        System.out.println("car -------DisposableBean----destroy---");
    }


}
